import { createRouter, createWebHistory } from 'vue-router'
import BlogsView from '../views/BlogsView.vue'
import LoginView from '../views/LoginView.vue'
import BlogCreateView from '@/views/BlogCreateView.vue'
import BlogView from '@/views/BlogView.vue'
import SerchView from '@/views/SerchView.vue'

import home from "@/views/home.vue";
import PensonalCenter from "@/views/Pensonal center.vue";
import Setting from "@/views/Setting.vue";
import MySubscribtion from "@/views/My subscribtion.vue";
import MyFollowing from "@/views/My following.vue";
import MyMessage from "@/views/My message.vue";
import MyArticle from "@/views/My blog.vue";
import login from "@/components/login.vue";
import MyCollection from "@/views/My collection.vue";
import MyNotice from "@/views/My notice.vue";
import Fhome from "@/views/fhome.vue";
import BlogUpdateView from '@/views/BlogUpdateView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'blogs',
      component: BlogsView,
    },
    {
      path: '/search',
      name: 'search',
      component: SerchView
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
    {
      path: '/blogCreate',
      name: 'blogCreate',
      component: BlogCreateView
    },
    {
      path: '/blogUpdate',
      name: 'blogUpdate',
      component: BlogUpdateView
    },
    {
      path: '/blogView',
      name: 'blogView',
      component: BlogView
    },
    {
      path: '/user',
      component: Fhome,
    },
    {
      path: '/home',
      component: home,
      children: [
        { path: '/PersonalCenter', component: PensonalCenter },
        { path: '/MySubscribtion', component: MySubscribtion },
        { path: '/MyFollowing', component: MyFollowing },
        { path: '/MyArticle', component: MyArticle },
        { path: '/MyNotice', component: MyNotice },
        { path: '/Setting', component: Setting },
        { path: '/MyCollection', component: MyCollection },
        { path: '/MyMessage', component: MyMessage },
      ]
    }
  ]
})

export default router
